﻿namespace Commander.Core.Commons
{
    using System;
    using Commander.Core.Interfaces.Shared;
    using Commander.Core.Services.Shared;
    using Commander.Core.Services;

    /// <summary>
    /// Global Commander env. All static object start here
    /// </summary>
    public class E
    {
        #region static services accessors

        /// <summary>
        /// Get IContainer instance
        /// </summary>
        public static IContainer Container
        {
            get { return _concretContainer; }
        }

        /// <summary>
        /// Get IGuiManager instance
        /// </summary>
        public static IGuiManager Gui
        {
            get { return Singleton<IGuiManager>.Instance; }
        }

        /// <summary>
        /// Get IPluginManager instance
        /// </summary>
        public static IPluginManager Plugins
        {
            get { return Singleton<IPluginManager>.Instance; }
        }

        /// <summary>
        /// Get IStateController instance
        /// </summary>
        public static IStateController State
        {
            get { return Singleton<IStateController>.Instance; }
        }

        /// <summary>
        /// Get ICommandController instance
        /// </summary>
        public static ICommandController Command
        {
            get { return Singleton<ICommandController>.Instance; }
        }

        /// <summary>
        /// Get IOperationManager instance
        /// </summary>
        public static IOperationManager Operations
        {
            get { return Singleton<IOperationManager>.Instance; }
        }

        #endregion        

        private static IContainer _concretContainer = new QuickContainer();

        /// <summary>
        /// Load all stuff on first access to E
        /// </summary>
        static E()
        {            
            new Bootstrap().Load();
        }

        /// <summary>
        /// To prevent from creation of new instance
        /// </summary>
        private E()
        {

        }
    }
}
